# -*- coding: utf8-*-
import os

_author_ = 'yykrlc'

DB_PORT = os.environ.get('DB_PORT') or '3306'
DB_NAME = "doodle_production"
CHARSET = '?charset=utf8mb4'

DB_USERNAME = os.environ.get('DB_USERNAME') or 'nds_admin'
DB_PASSWORD = os.environ.get('DB_PASSWORD') or 'GSd2!D3sd3&^%&g'
DB_HOST = os.environ.get('DB_HOST') or 'rm-bp1001kd257gv6q5k.mysql.rds.aliyuncs.com'
DB_PORT = os.environ.get('DB_PORT') or '3306'
DB_NAME = "nds_admin_production"
DB_CHARSET = '?charset="utf8mb4'
# ------------------------------

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True  # 自动提交
    SQLALCHEMY_RECORD_QUERIES = True  #
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    SQLALCHEMY_NATIVE_UNICODE = 20
    SQLALCHEMY_POOL_RECYCLE = 60 * 60 
    DEBUG = True

    @staticmethod
    def init_app(app):
        pass

class ProductionConfig(Config):
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'mysql+mysqlconnector://' + DB_USERNAME + ':' + DB_PASSWORD + '@' + DB_HOST + ':' + DB_PORT + '/' + DB_NAME + CHARSET

class BaseConfig(object):
    # 消息自定义token,约定的秘钥
    #token = '7EDsEkpBSRw8DlmcL2wGvqTFHGuwB9Reub1za7ykUeX'
    #CELERY_BROKER_URL = 'redis://localhost:6379/2'
    #CELERY_RESULT_BACKEND = 'redis://localhost:6379/2'
    #CELERY_TASK_SERIALIZER = 'json'
    component_appid = "wx071e1e08f6cc431a"  # open 平台 appid
    component_appsecret = "5450b02fc2f1ae901f00902f283fd76b"
    open_token = '7EDsEkpBSRw8DlmcL2wGvqTFHGuwB9Reub1za7ykUeX'
    encodingAESKey = "oGNBdeRADWZxusO0xh8YW8x1LyMgTUdvOtOJK3LNfsX"
    #ADMIN_URL = 'http://app.ndmooc.com/wx'
    #api_file_url = 'http://test.api.ndmooc.com' # 上传文件的url
    #hosts = '192.168.0.201:22190'
class BaseData(object):
    # 信息缓存
    def __init__(self):
        pass

#PORT = 5011

# ---redis---
# redis config
REDIS_HOST = '127.0.0.1'
REDIS_PORT = '6379'
REDIS_DB = '4'
REDIS_PASSWORD = ''
